﻿using System;
using System.Linq;
using CodeCounsel.SharePoint.RibbonDesigner.Model;
using System.Collections.ObjectModel;
using System.Collections.Generic;

namespace CodeCounsel.SharePoint.RibbonDesigner.ViewModel
{
    public class GroupRowViewModel
        : BaseViewModel
    {
        Row _row;
        public ObservableCollection<ControlRefViewModel> Items { get; private set; }

        public GroupRowViewModel(Group group, Row row, Func<string, IEnumerable<Control>> controlSelector)
        {
            _row = row;
            Items = new ObservableCollection<ControlRefViewModel>(row.ControlRefs
                .Select( item => new ControlRefViewModel((ControlRef)item, controlSelector)));
        }
    }
}
